
import BaseComponent from "../components/BaseComponent";
import SceneManager from "../Managers/SceneManager";
import PanelManager from "../Managers/PanelManager";
import GameScene from "./GameScene";
import ResMgr from "../Managers/ResMgr";
const {ccclass, property} = cc._decorator;

@ccclass
export default class LoginScene extends BaseComponent {

    onLoad () 
    {
        super.onLoad();

        this.add_button_listen("startGame", this, this.onGameStartClick);   
        // console.log(ResMgr.Instance.getAsset("Bullet","1"));

        var sp:cc.Node = this.node.getChildByName("icon");
        var texture2d:cc.Texture2D = ResMgr.Instance.getAsset("Bullet","1");
        sp.getComponent(cc.Sprite).spriteFrame.setTexture(texture2d);
        sp.setContentSize(cc.size(texture2d.width,texture2d.height));
        // sp.getComponent(cc.Sprite).spriteFrame.loaded()
        // sp.getComponent(cc.Sprite).spriteFrame = 
        // sp.getComponent(cc.Sprite).spriteFrame = (ResMgr.Instance.getAsset("Bullet","1"));

    }


    private onGameStartClick(): void 
    {

        // UIManager.getInstace().showPanel();
        var scene:cc.Node = SceneManager.getInstace().change_scene("GameScene");
        scene.addComponent(GameScene);

    }


    start () {

    }

    // update (dt) {}
}
